﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;


using Xc.DataAccess.CodeReader;

namespace Microsoft.Extensions.DependencyInjection
{
    public static class ApplicationExtension
    {
        /// <summary>
        /// 添加相机服务,注入的服务有
        /// <list type="number">
        /// <item>相机图片服务<see cref="ICameraService"/></item>
        /// <item>相机工厂服务<see cref="ICameraFactoryService"/></item>
        /// </list>
        /// </summary>
        /// <param name="serviceDescriptors"></param>
        /// <returns></returns>
        public static IServiceCollection AddCameraService(this IServiceCollection serviceDescriptors)
        {
            serviceDescriptors.AddSingleton<ICameraFactoryService, CameraFactoryService>();
            serviceDescriptors.AddTransient<IOpenCvService, OpenCvService>();
            serviceDescriptors.AddMatFilterService();
            return serviceDescriptors;
        }
        /// <summary>
        /// 添加图像过滤服务
        /// </summary>
        /// <param name="serviceDescriptors"></param>
        /// <returns></returns>
        internal static IServiceCollection AddMatFilterService(this IServiceCollection serviceDescriptors)
        {
            serviceDescriptors.AddTransient<IMatFilterService, MatFilterService>();
            return serviceDescriptors;
        }
    }
}